<!doctype>
<html lang="zh">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>一码通网上商城</title>
<meta name="keywords" content="一码通网上商城" />
<meta name="description" content="一码通网上商城" />
<style type="text/css">
.default img{
	width:80%;
	margin:0 10%;
}
.ncs-key ul li.sp-img a{
     padding:0 10px!important;
    border-width:1px!important;
    line-height:24px!important;
}
.ncs-key ul li.sp-img a:hover, .ncs-key ul li.sp-img a.hovered{
    padding:0 10px!important;
    border-width:1px!important;
    line-height:24px!important;
}
#quantity{
    text-align: center;
}
.ncs-figure-input a{
    left:32px!important;
}
#quantity{
    height:30px!important;
}
.ncs-cart-popup{
    height:auto!important;
}
</style>
<link rel="shortcut icon" href="http://beian.80wlkj.com/favicon.ico" />
<link rel="stylesheet" href="../css/common.css">
<link rel="stylesheet" href="../css/reset.css">
<link href="http://beian.80wlkj.com/shop/templates/default/css/base.css" rel="stylesheet" type="text/css">
<link href="http://beian.80wlkj.com/shop/templates/default/css/home_header.css" rel="stylesheet" type="text/css">
<link href="http://beian.80wlkj.com/shop/templates/default/css/home_login.css" rel="stylesheet" type="text/css">
<link href="http://beian.80wlkj.com/shop/templates/default/css/home_goods.css" rel="stylesheet" type="text/css">
<link href="http://beian.80wlkj.com/shop/resource/font/font-awesome/css/font-awesome.min.css" rel="stylesheet" />

<script src="http://beian.80wlkj.com/data/resource/js/jquery.js"></script>
<script type="text/javascript" src="../js/common.js"></script>
<script type="text/javascript" src="../js/storage.js"></script>
<script type="text/javascript" src="../js/goodsLoop.js"></script>
<script type="text/javascript" src="../js/jquery.jqzoom.js"></script>
<script src="http://beian.80wlkj.com/data/resource/js/common.js" charset="utf-8"></script>
<script src="http://beian.80wlkj.com/data/resource/js/jquery-ui/jquery.ui.js"></script>
<script src="http://beian.80wlkj.com/data/resource/js/jquery.validation.min.js"></script>
<script src="http://beian.80wlkj.com/data/resource/js/jquery.masonry.js"></script>
<script src="http://beian.80wlkj.com/data/resource/js/dialog/dialog.js" id="dialog_js" charset="utf-8"></script>
<script type="text/javascript" src="http://beian.80wlkj.com/data/resource/js/jquery.charCount.js"></script>
<script src="http://beian.80wlkj.com/data/resource/js/jquery.ajaxContent.pack.js" type="text/javascript"></script>
<script src="http://beian.80wlkj.com/data/resource/js/sns.js" type="text/javascript" charset="utf-8"></script>
<script src="http://beian.80wlkj.com/data/resource/js/jquery.F_slider.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" src="http://beian.80wlkj.com/data/resource/js/waypoints.js"></script>
<script type="text/javascript" src="http://beian.80wlkj.com/data/resource/js/jquery.raty/jquery.raty.min.js"></script>
<script type="text/javascript" src="http://beian.80wlkj.com/data/resource/js/jquery.nyroModal/custom.min.js" charset="utf-8"></script>
<link href="http://beian.80wlkj.com/data/resource/js/jquery.nyroModal/styles/nyroModal.css" rel="stylesheet" type="text/css" id="cssfile2" />

<script type="text/javascript" src="http://beian.80wlkj.com/data/resource/js/jquery.cookie.js"></script>
<link href="http://beian.80wlkj.com/data/resource/js/perfect-scrollbar.min.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="http://beian.80wlkj.com/data/resource/js/perfect-scrollbar.min.js"></script>
<script type="text/javascript" src="http://beian.80wlkj.com/data/resource/js/qtip/jquery.qtip.min.js"></script>
<link href="http://beian.80wlkj.com/data/resource/js/qtip/jquery.qtip.min.css" rel="stylesheet" type="text/css">
<script src="http://beian.80wlkj.com/shop/resource/js/compare.js"></script>
<!--[if IE 7]>
  <link rel="stylesheet" href="http://beian.80wlkj.com/shop/resource/font/font-awesome/css/font-awesome-ie7.min.css">
<![endif]-->

<!--[if lt IE 9]>
      <script src="http://beian.80wlkj.com/data/resource/js/html5shiv.js"></script>
      <script src="http://beian.80wlkj.com/data/resource/js/respond.min.js"></script>
<![endif]-->
<!--[if IE 6]>
<script src="http://beian.80wlkj.com/data/resource/js/IE6_PNG.js"></script>
<script>
DD_belatedPNG.fix('.pngFix');
</script>
<script>
// <![CDATA[
if((window.navigator.appName.toUpperCase().indexOf("MICROSOFT")>=0)&&(document.execCommand))
try{
document.execCommand("BackgroundImageCache", false, true);
   }
catch(e){}
// ]]>
</script>
<![endif]-->
<script type="text/javascript">
var PRICE_FORMAT = '&yen;%s';
$(function(){
	$('#button').click(function(){
	    if ($('#keyword').val() == '') {
		    return false;
	    }
	});
    });

$(function(){
	//search
	var act = "goods";
	if (act == "store_list"){
		$("#search").children('ul').children('li:eq(1)').addClass("current");
		$("#search").children('ul').children('li:eq(0)').removeClass("current");
		}
	$("#search").children('ul').children('li').click(function(){
		$(this).parent().children('li').removeClass("current");
		$(this).addClass("current");
		$('#search_act').attr("value",$(this).attr("act"));
		$('#keyword').attr("placeholder",$(this).attr("title"));
	});
	$("#keyword").blur();
	/*$("img").lazyload({
    	placeholder : "http://beian.80wlkj.com/shop/templates/default/images/grey.gif",  
		effect : "fadeIn",  
    	failurelimit : 10  
		
    });*/
});
</script>
</head>
<body>
<div class="public-top-layout w">
<div class="topbar wrapper">
<div class="user-entry">
您好 <span>
<span id="username"></span>
</span> ，欢迎来到 <a href="" title="首页" alt="首页"><span>一码通网上商城</span></a><span><span id="loginIn">[登录]</span> </span><span><span id="register">[注册]</span> </span> <span><span id="loginOut">[退出]</span> </span>
</div>
<div class="quick-menu">
<dl>
<dt><a href="http://beian.80wlkj.com/shop/index.php?act=show_joinin&op=index" title="免费开店">免费开店</a><i></i></dt>
<dd>
<ul>
<li><a href="http://beian.80wlkj.com/shop/index.php?act=show_joinin&op=index" title="招商入驻">招商入驻</a></li>
<li><a href="http://beian.80wlkj.com/shop/index.php?act=seller_login&op=show_login" target="_blank" title="登录商家管理中心">商家登录</a></li>
</ul>
</dd>
 </dl>
<dl>
<dt><a href="../view/orderList.html?act=member_order">我的订单</a><i></i></dt>
<dd>
<ul>
<li><a href="../view/orderList.html?act=member_order&state_type=state_new">待付款订单</a></li>
<li><a href="../view/orderList.html?act=member_order&state_type=state_send">待确认收货</a></li>
<li><a href="../view/orderList.html?act=member_order&state_type=state_noeval">待评价交易</a></li>
</ul>
</dd>
</dl>
</div>
</div>
</div>
<div class="header-wrap">
<header class="public-head-layout wrapper">
<h1 class="site-logo"><a href="" style="display:block;;width:60%;margin:0 auto;"><img src="../imgs/index/logo.png" class="pngFix"></a></h1>
<div style="float:left;height:90px;line-height:90px;">
<ul class="site-menu">
<li><a href="http://beian.80wlkj.com" class="current">首页</a></li>
<li><a href="http://beian.80wlkj.com/shop/index.php?act=brand&op=index"> 品牌</a></li>
 <li><a href="http://beian.80wlkj.com/shop/index.php?act=store_list&op=index">店铺</a></li>
<li><a href="http://beian.80wlkj.com/microshop">个人中心</a></li>
</ul>
</div>

<div id="search" class="head-search-bar" style="float:right;">

<ul class="tab">
<li title="请输入您要搜索的商品关键字" act="search" class="current">商品</li>
<li title="请输入您要搜索的店铺关键字" act="store_list">店铺</li>
</ul>
<form class="search-form" method="get" action="http://beian.80wlkj.com/shop">
<input type="hidden" value="search" id="search_act" name="act">
<input placeholder="请输入您要搜索的商品关键字" name="keyword" id="keyword" type="text" class="input-text" value="" maxlength="60" x-webkit-speech lang="zh-CN" onwebkitspeechchange="foo()" x-webkit-grammar="builtin:search" />
<input type="submit" id="button" value="搜索" class="input-submit">
</form>
</div>
</header>
</div>



<div id="content" class="wrapper">
<div class="ncs-detail" style="position:static;">
<div style="float: left;">
	<div id="preview" class="spec-preview"> 
 	  <span class="jqzoom"></span> 
    </div>
    <!--缩图开始-->
    <div class="spec-scroll"> <a class="prev">&lt;</a> <a class="next">&gt;</a>
      <div class="items">
        <ul>
        </ul>
      </div>
    </div>
</div>
    
<div class="ncs-goods-summary" style="position:relative;">
<div id="goodsName" class="name">
<h1></h1>
</div>
<div class="ncs-meta">
<div class="rate"> <a href="#ncGoodsRate">商品评分</a>
<div class="raty" data-score="5" title="很满意" style="width: 100px;"><img src="http://beian.80wlkj.com/data/resource/js/jquery.raty/img/star-on.png" alt="1" title="很满意">&nbsp;<img src="http://beian.80wlkj.com/data/resource/js/jquery.raty/img/star-on.png" alt="2" title="很满意">&nbsp;<img src="http://beian.80wlkj.com/data/resource/js/jquery.raty/img/star-on.png" alt="3" title="很满意">&nbsp;<img src="http://beian.80wlkj.com/data/resource/js/jquery.raty/img/star-on.png" alt="4" title="很满意">&nbsp;<img src="http://beian.80wlkj.com/data/resource/js/jquery.raty/img/star-on.png" alt="5" title="很满意"><input type="hidden" name="score" value="5" readonly="readonly"></div>
 </div>
<dl>
<dt>市&nbsp;场&nbsp;价：</dt>
<dd id="costPrice" class="cost-price"><strong></strong></dd>
</dl>
<dl>
<dt>商&nbsp;城&nbsp;价：</dt>
<dd id="salePrice" class="price">
<strong></strong>
</dd>
</dl>
</div>
<div class="ncs-plus">

<dl class="ncs-freight">
<dt>
至　全国： </dt>
<dd id="transport_price">
<span id="nc_kd">卖家承担运费</span>
</dd>
<dd style="color:red;display:none" id="loading_price">loading.....</dd>
</dl>
</div>
<div class="ncs-key">
<div id="sku">
    
</div>
<dl>
<dt>购买数量：</dt>
<dd class="ncs-figure-input">
<input type="text" name="" id="quantity" value="1" size="3" maxlength="6" class="text w30">
<a href="javascript:void(0)" class="increase">+</a><a href="javascript:void(0)" class="decrease">-</a> <span>(当前库存<em id="kucun" nctype="goods_stock"></em>件 
)</span> </dd>
</dl>

</div>

<div class="ncs-btn">
<div nctype="goods_prompt" class="ncs-point">
<span class="yes">已选择 <strong></strong></span>
</div>



<div class="clear"></div>
 

<a href="javascript:void(0);" nctype="buynow_submit" class="buynow" title="立即购买">立即购买</a>

<a href="javascript:void(0);" nctype="addcart_submit" class="addcart" title="添加购物车">添加购物车</a>

<div class="ncs-cart-popup">
<dl>
<dt>成功添加到购物车<a title="关闭" onclick="$('.ncs-cart-popup').css({'display':'none'});">X</a></dt>
<dd class="btns"><a href="javascript:void(0);" class="ncs-btn-mini ncs-btn-green" onclick="location.href='../view/cart.html?act=cart'">查看购物车</a> <a href="javascript:void(0);" class="ncs-btn-mini" value="" onclick="$('.ncs-cart-popup').css({'display':'none'});">继续购物</a></dd>
</dl>
</div>
</div>
     <div style=" position: absolute; z-index: 1; top: -1px; right: -210px;">
        <div class="ncs-info">
            <div class="title">
                <h4></h4>
            </div>
            <div class="content">
                <dl class="all-rate">
                    <dt>综合评分：</dt>
                    <dd>
                        <div class="rating"><span style="width: 100%"></span></div><em>5</em>分
                    </dd>
                </dl>
                <div class="ncs-detail-rate">
                    <h5><strong>店铺动态评分</strong>与行业相比</h5>
                    <ul>
                        <li> 描述相符<span class="credit">5 分</span> <span class=""><i></i><em></em></span> </li>
                        <li> 服务态度<span class="credit">5 分</span> <span class=""><i></i><em></em></span> </li>
                        <li> 发货速度<span class="credit">5 分</span> <span class=""><i></i><em></em></span> </li>
                    </ul>
                </div>
                <!-- <dl class="no-border">
                    <dt>公司名称：</dt>
                    <dd></dd>
                </dl>
                <dl>
                    <dt>所&nbsp;&nbsp;在&nbsp;&nbsp;地：</dt>
                    <dd></dd>
                </dl> -->
                <div class="goto">
                    <a href="http://beian.80wlkj.com/shop/index.php?act=show_store&op=index&store_id=1">进入商家店铺</a>
                </div>
            </div>
        </div>
     </div>

</div>

</div>

<div class="clear"></div>
<div class="ncs-goods-main" id="main-nav-holder" style="width:1200px;margin:0 auto;">

<div class="ncs-promotion" id="nc-bundling" style="display:none;"></div>

<div class="tabbar pngFix" id="main-nav" style="width:100%;">
<div class="ncs-goods-title-nav">
<ul id="categorymenu">
<li class="current"><a id="tabGoodsIntro" href="#content">商品详情</a></li>
<li><a id="tabGoodsRate" href="#content">商品评价<em>(0)</em></a></li>
<li><a id="tabGoodsTraded" href="#content">销售记录<em></em></a></li>
<!-- <li><a id="tabGuestbook" href="#content">购买咨询</a></li> -->
</ul>
<!-- <div class="switch-bar"><a href="javascript:void(0)" id="fold">&nbsp;</a></div> -->
</div>
</div>
<div class="ncs-intro">
<div class="content bd" id="ncGoodsIntro">


<ul class="nc-goods-sort">

</ul>
<div class="ncs-goods-info-content">
<div class="default">
</div>
</div>
</div>
</div>
<div class="ncs-comment">
<div class="ncs-goods-title-bar hd">
<h4><a href="javascript:void(0);">商品评价</a></h4>
</div>
<div class="ncs-goods-info-content bd" id="ncGoodsRate">
<div class="top">
<div class="rate">
<p><strong>100</strong><sub>%</sub>好评</p>
<span>共有0人参与评分</span></div>
<div class="percent">
<dl>
<dt>好评<em>(100%)</em></dt>
<dd><i style="width: 100%"></i></dd>
</dl>
<dl>
<dt>中评<em>(0%)</em></dt>
<dd><i style="width: 0%"></i></dd>
</dl>
<dl>
<dt>差评<em>(0%)</em></dt>
<dd><i style="width: 0%"></i></dd>
</dl>
</div>
<div class="btns"><span>您可对已购商品进行评价</span>
<p><a href="../view/orderList.html?act=member_order&op=index" class="ncs-btn ncs-btn-red" target="_blank"><i class="icon-comment-alt"></i>评价商品</a></p>
</div>
</div>
<div class="ncs-goods-title-nav">
<ul id="comment_tab">
 <li data-type="all" class="current"><a href="javascript:void(0);">商品评价(0)</a></li>
<li data-type="1"><a href="javascript:void(0);">好评(0)</a></li>
<li data-type="2"><a href="javascript:void(0);">中评(0)</a></li>
<li data-type="3"><a href="javascript:void(0);">差评(0)</a></li>
</ul>
</div>

<div id="goodseval" class="ncs-commend-main"></div>
</div>
</div>
<div class="ncg-salelog">
<div class="ncs-goods-title-bar hd">
<h4><a href="javascript:void(0);">销售记录</a></h4>
</div>
<div class="ncs-goods-info-content bd" id="ncGoodsTraded">
<div class="top">
<div class="price">商&nbsp;城&nbsp;价<strong>179.00</strong>元<span>购买的价格不同可能是由于店铺往期促销活动引起的，详情可以咨询卖家</span></div>
</div>
<!-- <div class="ncs-sidebar">
<div class="ncs-sidebar-container">
<div class="title">
<h4>商品二维码</h4>
</div>
<div class="content">
<div class="ncs-goods-code">
<p><img src="http://beian.80wlkj.com/data/upload/shop/store/default_qrcode.png" title="商品原始地址：http://beian.80wlkj.com/shop/index.php?act=goods&op=index&goods_id=44"></p>
<span class="ncs-goods-code-note"><i></i>扫描二维码，手机查看分享</span> </div>
</div>
</div>
<div class="ncs-message-bar">
<div class="default">
<h5>一码通网上商城1</h5>
<span member_id="1"></span>
</div>
</div>
<div class="ncs-sidebar-container ncs-class-bar">
<div class="title">
<h4>商品分类</h4>
</div>
<div class="content">
<p><span><a href="http://beian.80wlkj.com/shop/index.php?act=show_store&op=goods_all&store_id=1&key=1&order=2">按新品</a></span><span><a href="http://beian.80wlkj.com/shop/index.php?act=show_store&op=goods_all&store_id=1&key=2&order=2">按价格</a></span><span><a href="http://beian.80wlkj.com/shop/index.php?act=show_store&op=goods_all&store_id=1&key=3&order=2">按销量</a></span><span><a href="http://beian.80wlkj.com/shop/index.php?act=show_store&op=goods_all&store_id=1&key=5&order=2">按人气</a></span></p>
<div class="ncs-search">
<form id="" name="searchShop" method="get" action="index.php">
<input type="hidden" name="act" value="show_store" />
<input type="hidden" name="op" value="goods_all" />
<input type="hidden" name="store_id" value="1" />
<input type="text" class="text w120" name="inkeyword" value="" placeholder="搜索店内商品">
<a href="javascript:document.searchShop.submit();" class="ncs-btn">搜索</a>
</form>
</div>
<ul class="ncs-submenu">
<li><span class="ico-none"><em>-</em></span><a href="http://beian.80wlkj.com/shop/index.php?act=show_store&op=goods_all&store_id=1">全部商品</a></li>
</ul>
</div>
</div>
<div class="ncs-sidebar-container ncs-top-bar">
<div class="title">
<h4>商品排行</h4>
</div> -->
</div>
</div>
</div>
<form id="buynow_form" method="post">
<input id="act" name="act" type="hidden" value="buy" />
<input id="op" name="op" type="hidden" value="buy_step1" />
</form>

<div class="footer">
	<ul class="server">
		<li>
			<img src="../imgs/index/01.png">
		</li>
		<li>
			<img src="../imgs/index/02.png">
		</li>
		<li>
			<img src="../imgs/index/03.png">
		</li>
		<li>
			<img src="../imgs/index/04.png">
		</li>
	</ul>
	<ul class="firmInfo">
		<img class="firmInfo__logo" src="../imgs/index/logo.png">
		<div class="firmInfo__text">
		    <div style="font-size:14px;color:#666;line-height:30px;">
		    	公司电话：
		    </div>
			<div class="firmPhone">
				400-100-0000
			</div>
			<div class="firmArea">
				公司地址：杭州市萧山区金城路358号蓝爵国际写字楼
			</div>
		</div>
		<div class="firmInfo__QRCode">
			<img src="../imgs/index/logo.png">
			<p>了解更多</p>
		</div>
		
	</ul>
</div>
</div>



<script type="text/javascript">
	$(function(){
		var username = storage.getStorage('username')||'';
		console.log(username);
		$('#username').html(username);
		if(!username){
			$('#loginIn').show();
			$('#register').show();
			$('#loginOut').hide();
		}else{
			$('#loginIn').hide();
			$('#register').hide();
			$('#loginOut').show();
		}
		$('#loginIn').click(function(){
			window.location.href = "./login.html"
		})
		$('#register').click(function(){
			window.location.href = "./register.html"
		})
		$('#loginOut').click(function(){
			storage.storageClear();
			window.location.href = "./login.html"
		})
		$('.goodsList ul li').click(function(){
			var href = './goodsDetail.html?id=' + this.id;
			window.location.href = href;
		})
		console.log(getQueryString('id'));
		$(".quick-menu dl").hover(function() {
        $(this).addClass("hover");
        },
         function() {
         $(this).removeClass("hover");
         });
	})
</script>


<script type="text/javascript">
    //收藏分享处下拉操作
    jQuery.divselect = function(divselectid,inputselectid) {
      var inputselect = $(inputselectid);
      $(divselectid).mouseover(function(){
          var ul = $(divselectid+" ul");
          ul.slideDown("fast");
          if(ul.css("display")=="none"){
              ul.slideDown("fast");
          }
      });
      $(divselectid).live('mouseleave',function(){
          $(divselectid+" ul").hide();
      });
    };
$(function(){
    //赠品处滚条
    $('#ncsGoodsGift').perfectScrollbar();
        // 加入购物车
    $('a[nctype="addcart_submit"]').click(function(){
        _addCart(checkQuantity());
    });
        // 立即购买
    $('a[nctype="buynow_submit"]').click(function(){
        buynow(checkQuantity());
    });

    $('#main-nav').waypoint(function(event, direction) {
        $(this).parent().parent().parent().toggleClass('sticky', direction === "down");
        event.stopPropagation();
    });

});

function checkSpec() {
    var spec_param = [{"sign":"249","url":"http:\/\/beian.80wlkj.com\/shop\/index.php?act=goods&op=index&goods_id=52"},{"sign":"250","url":"http:\/\/beian.80wlkj.com\/shop\/index.php?act=goods&op=index&goods_id=53"},{"sign":"251","url":"http:\/\/beian.80wlkj.com\/shop\/index.php?act=goods&op=index&goods_id=54"}];
    var spec = new Array();
    $('ul[nctyle="ul_sign"]').find('.hovered').each(function(){
        var data_str = ''; eval('data_str =' + $(this).attr('data-param'));
        spec.push(data_str.valid);
    });
    spec1 = spec.sort(function(a,b){
        return a-b;
    });
    var spec_sign = spec1.join('|');
    $.each(spec_param, function(i, n){
        if (n.sign == spec_sign) {
            window.location.href = n.url;
        }
    });
}

// 验证购买数量
function checkQuantity(){
    var quantity = parseInt($("#quantity").val());
    if (quantity < 1) {
        alert("请填写购买数量");
        $("#quantity").val('1');
        return false;
    }
    max = parseInt($('[nctype="goods_stock"]').text());
            if(quantity > max){
        alert("库存不足");
        return false;
    }
    return quantity;
}

// 立即购买js
function buynow(quantity){
    if (!quantity) {
        return;
    }

    var shopId = $('.ncs-info h4').data().shopId;
    var goodsId = getQueryString('id');
    var sku =  $('.ncs-point strong').html();
    var skuJson={
    };
    skuJson[sku.split(':')[0]]  = sku.split(':')[1];

    skuJson = JSON.stringify(skuJson);

    var goodsInfoArr = [];
    var goodsInfoJson = {};
    goodsInfoJson.goodsId = goodsId;
    goodsInfoJson.amount = quantity;
    goodsInfoJson.shopId = shopId;
    goodsInfoJson.sku = skuJson;
    goodsInfoArr.push(goodsInfoJson);
    goodsInfoArr = JSON.stringify(goodsInfoArr);

    var url = 'http://192.168.0.120:8080/ymshoping/shopsPurchase?goodsInfo='+goodsInfoArr+'&token='+storage.getStorage('token');
    $.ajax({
                url:url,
                dataType:'jsonp',
                jsonp:'callback',//传递给请求处理程序或页面的，用以获得jsonp回调函数名的参数名(默认为:callback)
                jsonpCallback:"success_jsonpCallback",//自定义的jsonp回调函数名称，默认为jQuery自动生成的随机函数名
                contentType: 'application/json; charset=utf-8',
                success:function(res){
                    if (res.code == 0) {
                        window.location.href = './confirm.html'
                    }
                },
                error:function(res){
                    console.log(res.responseText);
                }
            });
    
}

$(function(){
    //选择地区查看运费
    $('#transport_pannel>a').click(function(){
        var id = $(this).attr('nctype');
        if (id=='undefined') return false;
        var _self = this,tpl_id = '0';
        var url = 'index.php?act=goods&op=calc&rand='+Math.random();
        $('#transport_price').css('display','none');
        $('#loading_price').css('display','');
        $.getJSON(url, {'id':id,'tid':tpl_id}, function(data){
            if (data == null) return false;
            if(data != 'undefined') {$('#nc_kd').html('运费：<em>' + data + '</em>元');}else{'卖家承担运费';}
            $('#transport_price').css('display','');
            $('#loading_price').css('display','none');
            $('#ncrecive').html($(_self).html());
        });
    });
    $("#nc-bundling").load('index.php?act=goods&op=get_bundling&goods_id=52', function(){
        if($(this).html() != '') {
            $(this).show();
        }
    });
    $("#salelog_demo").load('index.php?act=goods&op=salelog&goods_id=52&store_id=1&vr=0', function(){
        // Membership card
        $(this).find('[nctype="mcard"]').membershipCard({type:'shop'});
    });
    $("#consulting_demo").load('index.php?act=goods&op=consulting&goods_id=52&store_id=1', function(){
        // Membership card
        $(this).find('[nctype="mcard"]').membershipCard({type:'shop'});
    });

/** goods.php **/
    // 商品内容部分折叠收起侧边栏控制
    $('#fold').click(function(){
        $('.ncs-goods-layout').toggleClass('expanded');
    });
    // 商品内容介绍Tab样式切换控制
    $('#categorymenu').find("li").click(function(){
        $('#categorymenu').find("li").removeClass('current');
        $(this).addClass('current');
    });
    // 商品详情默认情况下显示全部
    $('#tabGoodsIntro').click(function(){
        $('.bd').css('display','');
        $('.hd').css('display','');
    });
    // 点击评价隐藏其他以及其标题栏
    $('#tabGoodsRate').click(function(){
        $('.bd').css('display','none');
        $('#ncGoodsRate').css('display','');
        $('.hd').css('display','none');
    });
    // 点击成交隐藏其他以及其标题
    $('#tabGoodsTraded').click(function(){
        $('.bd').css('display','none');
        $('#ncGoodsTraded').css('display','');
        $('.hd').css('display','none');
    });
    // 点击咨询隐藏其他以及其标题
    $('#tabGuestbook').click(function(){
        $('.bd').css('display','none');
        $('#ncGuestbook').css('display','');
        $('.hd').css('display','none');
    });
    //商品排行Tab切换
    $(".ncs-top-tab > li > a").mouseover(function(e) {
        if (e.target == this) {
            var tabs = $(this).parent().parent().children("li");
            var panels = $(this).parent().parent().parent().children(".ncs-top-panel");
            var index = $.inArray(this, $(this).parent().parent().find("a"));
            if (panels.eq(index)[0]) {
                tabs.removeClass("current ").eq(index).addClass("current ");
                panels.addClass("hide").eq(index).removeClass("hide");
            }
        }
    });
    //信用评价动态评分打分人次Tab切换
    $(".ncs-rate-tab > li > a").mouseover(function(e) {
        if (e.target == this) {
            var tabs = $(this).parent().parent().children("li");
            var panels = $(this).parent().parent().parent().children(".ncs-rate-panel");
            var index = $.inArray(this, $(this).parent().parent().find("a"));
            if (panels.eq(index)[0]) {
                tabs.removeClass("current ").eq(index).addClass("current ");
                panels.addClass("hide").eq(index).removeClass("hide");
            }
        }
    });

//触及显示缩略图
    $('.goods-pic > .thumb').hover(
        function(){
            $(this).next().css('display','block');
        },
        function(){
            $(this).next().css('display','none');
        }
    );

    /* 商品购买数量增减js */
    // 增加
    $('.increase').click(function(){
        num = parseInt($('#quantity').val());
                        max = parseInt($('[nctype="goods_stock"]').text());
        if(num < max){
            $('#quantity').val(num+1);
        }
    });
    //减少
    $('.decrease').click(function(){
        num = parseInt($('#quantity').val());
        if(num > 1){
            $('#quantity').val(num-1);
        }
    });

    //评价列表
    $('#comment_tab').on('click', 'li', function() {
        $('#comment_tab li').removeClass('current');
        $(this).addClass('current');
        load_goodseval($(this).attr('data-type'));
    });
    load_goodseval('all');
    function load_goodseval(type) {
        var url = 'http://beian.80wlkj.com/shop/index.php?act=goods&op=comments&goods_id=52';
        url += '&type=' + type;
        $("#goodseval").load(url, function(){
            $(this).find('[nctype="mcard"]').membershipCard({type:'shop'});
        });
    }

    //记录浏览历史
    $.get("index.php?act=goods&op=addbrowse",{gid:52});
    //初始化对比按钮
    initCompare();
});
/* 加入购物车后的效果函数 */
function addcart_callback(data){
    $('.ncs-cart-popup').fadeIn('fast');
}
</script>
<script type="text/javascript">
    $(function(){
       _init();
    })
    function _init(){
         var goodsId = getQueryString('id');
        var url = 'http://192.168.0.120:8080/ymshoping/goodsDetails?goodsId='+goodsId+'&token='+storage.getStorage('token');
        $.ajax({
                url:url,
                dataType:'jsonp',
                jsonp:'callback',//传递给请求处理程序或页面的，用以获得jsonp回调函数名的参数名(默认为:callback)
                jsonpCallback:"success_jsonpCallback",//自定义的jsonp回调函数名称，默认为jQuery自动生成的随机函数名
                contentType: 'application/json; charset=utf-8',
                success:function(res){
                    console.log(res);
                  
                    var costPrice = parseFloat(res.market).toFixed(2);
                    var salePrice = parseFloat(res.mall).toFixed(2);
                    var sku = res.sku;
                    var goodsDetails = '';
                    var picIds = res.picId;
                    var loopPicIds = res.stylePicId;
                    var picHtml = '';
                    var loopPicHtml = '';
                    $('#goodsName h1').html(res.goodsName);
                    $('#costPrice strong').html(costPrice);
                    $('#salePrice strong').html(salePrice);
                    $('#kucun').html(res.stock);
                    Object.keys(sku).forEach(function(item){
                        var temp = '';
                        var skuTitle= '<dt>' + item + '：</dt>';
                        var skuValue = '';
                        sku[item].forEach(function(val){
                             skuValue += '<li class="sp-img"><a href="javascript:void(0);" title="'+val+'">'+val+'<i></i></a></li>';
                        })
                        temp += '<dl nctype="nc-spec">' + skuTitle + '<dd><ul nctyle="ul_sign">' + skuValue + '</ul></dd><dl>'
                        console.log(temp);
                        $('#sku').html(temp);

                         $('dl[nctype="nc-spec"] ul li').eq(0).find('a').addClass('hovered');
                        $('.ncs-point strong').html(item +':'+ $('dl[nctype="nc-spec"] ul li').eq(0).find('a').text());
                    })

                    Object.keys(res.details).forEach(function(item){
                       goodsDetails += '<li>'+item+':'+res.details[item]+'</li>'
                       console.log(goodsDetails);
                    })
                    console.log(goodsDetails);
                    $('.nc-goods-sort').html(goodsDetails);
                    $('#tabGoodsTraded em').html('(' + res.sale + ')');
                    picIds.forEach(function(item,index){
                        var imgSrc ="http://192.168.0.120:8080/ymshoping/pic?picId="+item;
                        picHtml += '<img src="'+imgSrc+'"/>' 
                        console.log(picHtml);
                    })
                    loopPicIds.forEach(function(item,index){
                        loopPicHtml += '<li><img alt="" bimg="http://192.168.0.120:8080/ymshoping/pic?picId='+item+'"src="http://192.168.0.120:8080/ymshoping/pic?picId='+item+'" onmousemove="preview(this);"></li>'
                    })
                    var bgImg = '<img jqimg="http://192.168.0.120:8080/ymshoping/pic?picId='+loopPicIds[0]+'" src="http://192.168.0.120:8080/ymshoping/pic?picId='+loopPicIds[0]+'images/s1.jpg" style="width:100%;" />'
                    $('.spec-scroll ul').html(loopPicHtml);
                    $('.jqzoom').html(bgImg);
                    console.log(loopPicHtml);

                    $('.ncs-goods-info-content').find('.default').html(picHtml);
                    $('.ncs-info h4').html(res.shopsList.shopsListName);
                    $('.ncs-info h4').data( "shopId",res.shopsList.shopsListId);

                    // 规格选择
                     $('dl[nctype="nc-spec"]').find('a').each(function(){
                     $(this).on('click',function(){
                         console.log(111);
                         if ($(this).hasClass('hovered')) {
                             return false;
                         }
                         $(this).parents('ul:first').find('a').removeClass('hovered');
                         $(this).addClass('hovered');
                         console.log($(this).text())
                         $('.ncs-point strong').html($('dl[nctype="nc-spec"] dt').html()+$(this).text());
                     });
                 });

                },
                error:function(res){
                    console.log(res.responseText);
                }
            });
    }
    function _addCart(quantity){
        var shopId = $('.ncs-info h4').data().shopId;
        var goodsId = getQueryString('id');
        var sku =  $('.ncs-point strong').html();

        console.log(sku);

        var skuJson={
        };
        skuJson[sku.split(':')[0]]  = sku.split(':')[1];

        console.log(skuJson[sku.split(':')[0]]);

        console.log(skuJson);

        skuJson = skuJson;

        var goodsInfoArr = [];
        var goodsInfoJson = {};
        goodsInfoJson.goodsId = goodsId;
        goodsInfoJson.amount = quantity;
        goodsInfoJson.shopId = shopId;
        goodsInfoJson.sku = skuJson;
        console.log(goodsInfoJson);
        // goodsInfoArr.push(goodsInfoJson);
        goodsInfoJson = JSON.stringify(goodsInfoJson);

        var url = 'http://192.168.0.120:8080/ymshoping/goodsCar?goodsInfo='+goodsInfoJson+'&token='+storage.getStorage('token');

        $.ajax({
                url:url,
                dataType:'jsonp',
                jsonp:'callback',//传递给请求处理程序或页面的，用以获得jsonp回调函数名的参数名(默认为:callback)
                jsonpCallback:"success_jsonpCallback",//自定义的jsonp回调函数名称，默认为jQuery自动生成的随机函数名
                contentType: 'application/json; charset=utf-8',
                success:function(res){
                    if(res.code == 0){
                        addcart_callback();
                    }
                },
                error:function(res){
                    console.log(res.responseText);
                }
            });
    
    }

</script>
</body>
</html>
